import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class WidgetInputButton extends StatefulWidget{

  const WidgetInputButton({Key key}) : super(key: key);

  @override
  _widgetInputBottonState createState()=>_widgetInputBottonState();
}

class _widgetInputBottonState extends State<WidgetInputButton>{

  TextEditingController controller;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    controller=new TextEditingController();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Container(
      width: ScreenUtil().setWidth(165),
      margin: EdgeInsets.only(top: 5.0),
      decoration:
      BoxDecoration(border: Border.all(color: Colors.black12, width: 0.5)),
      child: Row(
        children: <Widget>[
          inputWidget(),
          _rightBtn(),
        ],
      ),
    );
  }

  //完成按钮
  Widget _rightBtn() {
    return InkWell(
      onTap:(){

      },
      child: Container(
        alignment: Alignment.center,
        height: ScreenUtil().setHeight(45),
        width: ScreenUtil().setWidth(81),
        decoration: BoxDecoration(
            color:Colors.blue,
            border:
            Border(right: BorderSide(color: Colors.black12, width: 0.5))),
        child: Text(
          '完成',
          style: TextStyle(color:Colors.white),
        ),
      ),
    );
  }

  //输入框
  Widget inputWidget(){
    return Container(
      alignment: Alignment.center,
      height: ScreenUtil().setHeight(45),
      width: ScreenUtil().setWidth(81),
      decoration: BoxDecoration(
          color:Colors.white,
          border:
          Border(left: BorderSide(color: Colors.blue, width: 0.5))),
      child: TextField(
        keyboardType: TextInputType.number,
        controller: controller,
        maxLines: 1,
        autofocus: false,
        decoration: InputDecoration(
          hintText: '0',
          contentPadding: EdgeInsets.only(top: 5.0)
        ),
      ),
    );
  }

}